package priv.demos.demo1.solution.main;

import java.io.Serializable;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created on 2017/1/11.
 */
public class Main1 {

    public static void main(String[] args) throws Exception {
        String str = " t + 20s ";

        String patternString = "\\s*([TDWtdw])\\s*\\+\\s*(\\d+)\\s*";
        Pattern pattern = Pattern.compile(patternString);
        Matcher matcher = pattern.matcher(str);
        System.out.println(matcher.matches());
        System.out.println(str.substring(matcher.start(1), matcher.end(1)));
        System.out.println(str.substring(matcher.start(2), matcher.end(2)));

    }

    static class Model implements Serializable{
        private String name;
        private Date date;

        public Model(String name, Date date) {
            this.name = name;
            this.date = date;
        }
    }

}